package per.ethan.springboot.example.job;

import cn.hutool.core.date.DateUtil;
import org.quartz.DisallowConcurrentExecution;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;

/**
 * @author Ethan
 * @date 2020/06/07 15:45
 */
@Component
// 不允许并发执行
@DisallowConcurrentExecution
public class HelloJob implements Job {

    @Override
    public void execute(JobExecutionContext jobExecutionContext) {
        System.out.println("hello world:" + DateUtil.formatLocalDateTime(LocalDateTime.now()));
    }

}
